在瀏覽器與 node.js 運行 javascript


Posted by ericcch24 on 2020-06-22

瀏覽器

  • 用 git 建立一個 html 的檔案
  • vim 執行
  • 在 html 檔案中撰寫,並於兩個標籤間撰寫JavaScript程式碼。例如:
    <script>
    console.log("hello world")
    </script>
    
  • 存檔後用瀏覽器開啟此檔,F12 就看到上面程式碼的輸出結果

node.js

  • 用 git 建立一個 javascript 的檔案
  • 在裡面輸入
    console.log("hello world")
    
  • 在 git 輸入 node 檔名.js 即可輸出檔案的內容
    (或是直接在 git 輸入 node 也可以直接運行)

#WeeK2







Related Posts

Day3 安裝資料庫吧 ! FireBase!

Day3 安裝資料庫吧 ! FireBase!

Redux(三):純函數 (Pure Function) 簡介

Redux(三):純函數 (Pure Function) 簡介

Day 03:  GraphQL and GiHub GrapQL - Operations, Variables, and Mutations

Day 03: GraphQL and GiHub GrapQL - Operations, Variables, and Mutations


Comments